import { post } from '@/api/http';
import { defineStore } from 'pinia'

export const useColorInformationStore = defineStore('colorInformation', {
    state: () => {
        return {
            total: 0,
            page: 1,
            size: 10,
            table: {
                dataList: []
            } as any,
            selectedRowKeys: [] as any,
            rowKey: 'id',
            tableColumns: [
                {
                    title: "序号",
                    key: "colorCode",
                    dataIndex: "colorCode",
                    width: 150,
                },

                {
                    title: "色称",
                    key: "colorName",
                    dataIndex: "colorName",
                    width: 150,
                },
                {
                    title: "色号",
                    key: "colorNumber",
                    dataIndex: "colorNumber",
                    width: 150,
                },
                {
                    title: "备注",
                    key: "remark",
                    dataIndex: "remark",
                    width: 150,
                },

                {
                    title: "创建人",
                    key: "createName",
                    dataIndex: "createName",
                    width: 150,
                },
                {
                    title: "创建时间",
                    key: "createTime",
                    dataIndex: "createTime",
                    width: 200,
                },
                {
                    title: "最后修改人",
                    key: "updateName",
                    dataIndex: "updateName",
                    width: 150,
                },
                {
                    title: "最后修改时间",
                    key: "updateTime",
                    dataIndex: "updateTime",
                    width: 200,
                },
                {
                    title: "是否停用",
                    key: "obsoleteState",
                    dataIndex: "obsoleteState",
                    slotName: 'obsoleteState',
                    width: 150,
                    fixed: 'right'
                },
                // {
                //     title: "删除状态",
                //     key: "deleteState",
                //     dataIndex: "deleteState",
                //     width: 100,
                //     slotName: "deleteState",
                //     fixed: 'right'
                // },
                {
                    title: "操作",
                    key: "edit",
                    dataIndex: "edit",
                    slotName: 'edit',
                    width: 150, fixed: 'right'
                },
            ] as any,
            pageData: {
                showAdd: false,
                sideTitle: '新增色号色称资料',
                pageLoading: false,
                rHeight: "",
                btnList: [],
                isEdit: false
            } as any,
        };
    },
    actions: {
        selectBd() {
            return post({
                url: "product/color/getColorPage",
                data: {
                    page: this.page,
                    size: this.size,
                    deleteState: 0,
                }
            })
        },
    },
})